package com.springboot.ykz.dependinject.controller;

import com.springboot.ykz.dependinject.Animal;
import com.springboot.ykz.dependinject.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.lang.model.element.NestingKind;
import java.util.HashMap;
import java.util.Map;

@Controller
public class DiController {

    @Autowired
    private Person p = null;

    //@Autowired
    //private Animal animal = null;

    @RequestMapping("/test")
    @ResponseBody
    public Map<String, Boolean> Test() {

        Map<String, Boolean> m = new HashMap<>();
        p.service();
        m.put("di", p != null);
        return m;
    }


}
